<template>
  <div class="content">
    <div id="canvas-container"></div>
  </div>
</template>

<script setup>
import { Meta2d, } from '@meta2d/core';
import { onMounted, ref , onUnmounted } from 'vue';
import { Topology } from '@topology/core';
onMounted(() => {
  
var canvas = new Topology('canvas-container',{
  disableMove: true,       // 禁止移动
    disableAnchor: true,     // 禁止调整大小
    disableLine: true,       // 禁止连线
    disableContextMenu: true // 禁用右键菜单
});
fetch('/json/2d.json')
  .then(response => response.json())
  .then(data => {
    console.log(data);
    
    canvas.open(data); // 直接传入解析后的JSON对象
    canvas.lock = true; // 核心！强制锁定画布
  })
  .catch(error => {
    console.error('加载JSON失败:', error);
  });

})
</script>
<style scoped>
#canvas-container {
  position: absolute !important;
  width: 100%;
  height: 100%;
  touch-action: none;
  overflow: hidden;
}
</style>
